<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>修改公告</title>

    <style>
        /* 右侧内容区域 */
        .index-content {
            position: relative;
            margin-left: 222px;
            margin-top: -783px;
            padding: 20px;
            min-height: 86vh;
            z-index: 1;
        }

        .index-content::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: url("img/rightbg.jpg");
            background-size: cover;
            opacity: 0.3;
            z-index: -1;
        }
        /* 操作区域标题 */
        .index-content-operation .info-detail {
            font-size: 30px;
            font-weight: bold;
            font-family: youyuan;
            color: #333;
        }

        /* 表单容器样式 */
        form {
            background-color: #fdf6e4;
            padding: 30px;
            margin: 0 30px;
            /*margin-top: -20px;*/
            border: 1px solid #a45635;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            max-width: 600px;
        }

        /* 表格样式 */
        .index-content-table-add {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }

        .index-content-table-add td{
            padding: 12px;
            text-align: left;
            border-bottom: 1px dashed #be5234;
        }
        textarea{
            font-size: 16px;
            border: 1px solid #888888;
            border-radius: 4px;
        }

        .index-content-table-add td input {
            padding: 8px;
            font-size: 14px;
            border: 1px solid #888888;
            border-radius: 4px;
            margin-top: 5px;
        }

        /* 特殊的输入框 */
        .index-content-table-td-add {
            width: calc(100% - 16px);  /* 保证输入框不超过单元格 */
        }

        /* 单选框样式 */
        .index-content-table-add input[type="radio"] {
            margin-right: 8px;
        }

        /* 禁用的输入框样式 */
        .index-content-table-add input[disabled] {
            background-color: #f0f0f0;
            cursor: not-allowed;
        }

        /* 按钮样式 */
        button {
            padding: 10px 20px;
            font-size: 18px;
            font-weight: bold;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            margin-top: -20px;
            margin-left: 80px;
        }

        /* 提交按钮 */
        button[type="submit"] {
            background-color: #de7850;
            color: white;
        }

        /* 提交按钮悬浮效果 */
        button[type="submit"]:hover {
            background-color: #cc5c3c;
        }

        /* 取消按钮 */
        button[type="button"] {
            background-color: #504d4d;
            color: white;
        }

        /* 取消按钮悬浮效果 */
        button[type="button"]:hover {
            background-color: #333333;
        }

        /* 按钮间隔 */
        button + button {
            margin-left: 100px;
        }

        /* 输入框标题样式 */
        .index-content-table-add td:first-child {
            width: 12%;
            font-weight: bold;
            color: #333;
        }

        form br {
            clear: both;
        }
    </style>

</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail"> >> 修改公告</a>
        <br>
        <br>
    </div>
    <br>
    <form action="NoticeServlet?action=edit" method="post" onsubmit="return check()">
        <input type="hidden" id="id" name="id" value="${vo.id}"/><input type="hidden" id="createBy" name="createBy" value="${vo.createBy}"/>
        <table class="index-content-table-add">
            <tr>
                <td width="12%">标题：</td><td><input class="index-content-table-td-add" type="text" id="noticeName" name="noticeName" value="${vo.noticeName}"/></td>
            </tr>
            <tr>
                <td width="12%">内容：</td><td><textarea id="noticeText" name="noticeText" style="width: 60%; height: 100px;padding: 0px 10px;" placeholder="请输入内容......">${vo.noticeText}</textarea></td>
            </tr>
            <tr>
                <td width="12%">类型：</td><td><input class="index-content-table-td-add" type="text" id="noticeType" name="noticeType" value="${vo.noticeType}"/></td>
            </tr>
            <tr>
                <td width="12%">创建时间：</td><td><input class="index-content-table-td-add" type="text" id="createDate" name="createDate" value="${vo.createDate}"/></td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-line btn-primary btn-sm" onclick="javascript:history.back(-1);" style="width: 120px">取 消</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="submit" class="btn btn-line btn-success btn-sm" style="width: 120px">提 交</button>
    </form>
</div>

</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("noticeName").value.trim().length == 0) {
            alert("标题不能为空!");
            return false;
        }
        if (document.getElementById("noticeType").value.trim().length == 0) {
            alert("类型不能为空!");
            return false;
        }
        if (document.getElementById("createDate").value.trim().length == 0) {
            alert("创建时间不能为空!");
            return false;
        }
        return true;
    }
</script>
</html>
